home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import ctypes
- import sys
- from ctypes import Structure, byref, sizeof
- __all__ = [
- 'Struct',
- 'cimport']
-
- class Struct(Structure):
-
- def __init__(self, *a, **k):
- cls = type(self)
- fields = getattr(cls, '_fields_', None)
- if fields is None:
- raise AssertionError('ctypes.Structure must have _fields_')
-
- a = a + (0,) * (len(fields) - len(a))
- for name, native_type in enumerate(fields):
- setattr(self, name, k.pop(name, a[i]))
-
- if k:
- raise ValueError('not defined in _fields_: %s' % ', '.join(k))
-
-
-
- def __repr__(self):
- vals = (' '.join,)((lambda .0: for name, t in .0:
- '%s=%s' % (name, getattr(self, name)))(self._fields_))
- return '<%s %s>' % (type(self).__name__, vals)
-
-
- def ptr(self):
- return byref(self)
-
- ptr = property(ptr)
-
- def __len__(self):
- return sum((lambda .0: for name, t in .0:
- sizeof(t))(self._fields_))
-
-
- import os
-
- def cimport(**k):
- if os.name == 'nt':
- platform_dlls = ctypes.windll
- G = sys._getframe(1).f_globals
- for name, funcs in k.iteritems():
- dll = getattr(platform_dlls, name)
- (G.update,)((lambda .0: for func in .0:
- (func, getattr(dll, func)))(funcs))
-
- else:
- import gui.native as gui
- gui.native.notImplemented()
-
-